﻿using System;
using AspectsSample.DataContracts;
using AspectsSample.Repositories;

namespace AspectsSample
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "AspectsSampleService" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select AspectsSampleService.svc or AspectsSampleService.svc.cs at the Solution Explorer and start debugging.
    public class AspectsSampleService : IAspectsSampleService
    {
        public string GetData(int value)
        {
            return $"You entered: {value}";
        }

        public CompositeType GetDataUsingDataContract(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException(nameof(composite));
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }

        public ChannelModel GetChannel()
        {
            //should be using unity, caching and logging blocks ms pnp but this is a POC
            ChannelConfigRepository channelConfigRepository = new ChannelConfigRepository();
            return channelConfigRepository.Get();
        }
    }
}
